<template>
	<view class="content">
		<text style="font-size: 50rpx; display: block; text-align: center; margin-bottom: 20rpx;">子组件A</text>
		<view class="coma_box">
			<text>父组件传进来的值：</text>
			<text style="font-weight: bold;">{{ intent }}</text>
		</view>
		<button type="primary" @click="sendToParent()" style="margin-top: 20rpx; width: 100%;">传给CompB组件</button>
	</view>
</template>

<script>
	export default {
		props: ['intent'],
		name: "compA",
		methods: {
			sendToParent() {
				uni.$emit('getIntent', this.intent);
			}
		}
	};
</script>

<style>
	.content {
		background: pink; 
		padding: 30rpx 20rpx; 
		margin: 20rpx 0;
		border-radius: 8rpx;
	}

	.coma_box {
		margin: 20rpx 0;
	}
</style>